package jpb.module.dao.organize;

import jpb.module.dao.organize.mapper.OrganizeMemMapper;
import jpb.module.daomain.member.OrgMem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by haol on 2017/4/8.
 */
@Repository
public class OrganizeMemDao {


        private Logger logger = LoggerFactory.getLogger(OrganizeMemDao.class);
        @Autowired
        private OrganizeMemMapper mapper;

        public void add(OrgMem orgMem) {
                try {
                        mapper.add(orgMem);
                } catch (Exception e) {
                        logger.error(e.getMessage());
                }
        }

        public void delete(String oid, String memberNum) {
                try {
                        mapper.delete(oid, memberNum);
                } catch (Exception e) {
                        logger.error(e.getMessage());
                }
        }
        public void delete(String oid) {
                try {
                        mapper.deleteByOid(oid);
                } catch (Exception e) {
                        logger.error(e.getMessage());
                }
        }



        public Integer queryByOidNum(String oid,String memberNum){
                try{
                        return mapper.queryByOidNum(oid,memberNum);
                }catch (Exception e){
                        logger.error(e.getMessage());
                        return null;
                }
        }

        public void updateDid(OrgMem orgMem) {
                try{
                        mapper.updateDid(orgMem);
                }catch (Exception e){
                        logger.error(e.getMessage());
                }
        }

        public void updatePid(OrgMem orgMem) {
                try{
                        mapper.updatePid(orgMem);
                }catch (Exception e){
                        logger.error(e.getMessage());
                }
        }
        public List<String> getNumByDid(Integer did){
                try {
                        return mapper.getNumByDid(did);
                }catch (Exception e){
                        logger.error(e.getMessage());
                        return null;
                }
        }
        public List<String> getNumByOid(String oid){
                try {
                        return mapper.getNumByOid(oid);
                }catch (Exception e){
                        logger.error(e.getMessage());
                        return null;
                }
        }

        public List<String> getNumByDid(String oid,Integer did){
                try {
                        return mapper.getNumByOidDid(oid,did);
                }catch (Exception e){
                        logger.error(e.getMessage());
                        return null;
                }
        }
}
